/**
 * 深拷贝
 * @param {Object} obj
 */
const deepCopy = function(obj) {
  if (obj === null || !(obj instanceof Object)) {
    return obj
  }
  const copyObj = new obj.constructor()
  for (const key in obj) {
    if (Object.prototype.hasOwnProperty.call(obj, key)) {
      copyObj[key] = deepCopy(obj[key])
    }
  }
  return copyObj
}

export default deepCopy
